1. Field of the Invention
The invention relates to a block decoding method and system and, more particularly, to a block decoding method and system capable of decoding and outputting data in a longitudinal direction.
2. Description of Related Art
Block decoding is a known image compressing/decompressing technique. FIG. 1 is a block diagram of a well-known JPEG decoder 10. As shown, the JPEG decoder 10 is essentially constructed by a decoding device 110, a zigzag arranging device 120, an inverse quantizer 130, an inverse discrete cosine transform (IDCT) device 140, a color space converter 150 and a data buffer 160, thereby decoding a compressed datastream 100 in which a table 102 associated with compressed data 101 thereof is provided. The table 102 includes a Huffman coding table 111 and an quantization table 131 such that the decoding device 110 can perform a Huffman decoding on the compressed data 101 in accordance with the coding table 111 when the JPEG decoder 10 decodes the compressed datastream 101 to thus obtain a 1-D block consisting of 1-D arranged pixels. In accordance with the JPEG standard, the de-zigzag arranging device 120 recover the 1-D block into a 2-D block consisting of 2-D arranged pixels. As shown in FIG. 2, the arrows direct the zigzag sequence of pixel arrangement from the 1-D block to the 2-D block. Namely, the compressed pixels are arranged in a directional sequence of longitudinal (right), oblique (left lower), lower, oblique (right upper) and so on.
The de-quantizer 130 performs de-quantization on the 2-D block in accordance with the quantization table 131 to thus obtain a 2-D de-quantization block. FIG. 3 is an example of a content of the quantization table 131. The IDCT device 140 converts the 2-D de-quantization block from frequency domain to spatial domain. The color space converter 150 performs color conversion on the 2-D spatial block to thus convert its YCbCr format into a RGB format, thereby obtaining a decompressed image block similar to its source image.
The data buffer 160 provides with required memory for temporary data storage when processing of the Huffman decoding, the de-zigzag arrangement, the de-quantization and the IDCT.
As cited, the JPEG decoder 10 requires sequentially decoding the compressed datastream 100 first and then re-combines it into a complete decompressed image 200. For example, as to the decompressed image 200 represented by the smile face shown in FIG. 4, the JPEG decoder 10 sequentially decodes each block 41 in an A (horizontal) direction. However, when printing the decompressed image 200, a typical printer feeds paper in a B direction and fetches each block 41 of the decompressed image 200 in a C (longitudinal) direction. Accordingly, it is seen that the JPEG decoder 10 decodes the compressed datastream 100 for obtaining whole block 41 and storing them to the data buffer 160 first and then fetches the decompressed image 200 in the C direction for printing out. However, the data buffer 160 is increased with higher image resolution for storing more data. For an example of the decompressed image 200 with (M+1)×(N+1) blocks in FIG. 4, if every block requires 8×8×3 byte memory space, the JPEG decoder 10 requires a size of the data buffer 160 up to (M+1)×(N+1)×64×3 bytes, which needs very high hardware cost.
To overcome this, the U.S. Pat. No. 5,751,865 granted to Micco, et al. for a “Method and apparatus for image rotation with reduced memory using jpeg compression” discloses that in an encoding and compressing step, the image data is divided into blocks for pre-rotating operation in every block. Also, the location of each block in a JPEG file is recorded when encoding, and extracting the pre-rotated data when decoding. However, since such a process needs to rotate image in the compressing stage, a special compression format is introduced, which cannot support by standard JPEG decoder. In addition, since the JPEG file is rotated, only the longitudinal decoding can be performed, without a choice of decoding in a horizontal or longitudinal direction.
Further, the U.S. Pat. No. 6,298,166 granted to Ratnakar, et al. for an “Image transformations in the compressed domain” applies the standard JPEG encoding and also records additional information about compressed blocks for every compressed block. The additional information including indexes of the compressed blocks is not included in a standard JPEG compressed format but provided only for the special JPEG decoder. In accordance with the additional information, the special JPEG decoder can decode data in the longitudinal direction and output image according to the requirement of image rotation and mirror. Such a technique requires additional processes in encoding and compressing. Such a system is suitable for closed image input and output system because it need to teach longitudinal processing for an image output system. In addition, this patent discloses the processing of image mirror and rotation in frequency domain, not in spatial domain. Further, the processing of image mirror and rotation in frequency domain tends to a theoretical study, without an embodiment.
Therefore, it is desirable to provide an improved method to mitigate and/or obviate the aforementioned problems.